home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 518 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: solon.com!not-for-mail
  2. From: fred@genesis.demon.co.uk (Lawrence Kirby)
  3. Newsgroups: comp.lang.c.moderated,comp.std.c
  4. Subject: Behaviour of mem functions when n=0 ?
  5. Date: 6 Mar 1996 18:28:45 -0600
  6. Organization: none
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4hlaju$4g0@solutions.solon.com>
  10. Reply-To: fred@genesis.demon.co.uk
  11. NNTP-Posting-Host: solutions.solon.com
  12. X-Mailer: Demon Internet Simple News v1.27
  13.  
  14. In article <4hgc3d$97a@solutions.solon.com>
  15.            larry.jones@sdrc.com "Larry Jones" writes:
  16.  
  17.  > In article <4hdqn5$8qn@solutions.solon.com>, fred@genesis.demon.co.uk
  18.  > (Lawrence Kirby) writes about memcmp et al. with n==0:
  19.  > > Probably. However the result is defined by some rather unfortunate wording in
  20.  > > the standard:
  21.  > 
  22.  > The intent of the standard has been clarified by a Technical Corrigendum
  23.  > which adds the following text to the introductory matter in 7.11.1
  24.  > String Function Conventions:
  25.  > 
  26.  >         Where an argument declared as |size_t n| specifies the length of
  27.  >         the array for a function, |n| can have the value zero on a call
  28.  >         to that function.  Unless explicitly stated otherwise in the
  29.  >         description of a particular function in this subclause, pointer
  30.  >         arguments on such a call must still have valid values, as
  31.  >         described in subclause 7.1.7.  On such a call, a function that
  32.  >         locates a character finds no occurrence, a function that
  33.  >         compares two character sequences returns zero, and a function
  34.  >         that copies characters copies zero characters.
  35.  > 
  36.  > Note that this applies to the strn* functions as well as the mem*
  37.  > functions.
  38.  
  39. That does pretty much clear it up. However the wording for the individual
  40. functions is still nonsensical and it would have been better if that had
  41. been fixed.
  42.  
  43. -- 
  44. -----------------------------------------
  45. Lawrence Kirby | fred@genesis.demon.co.uk
  46. Wilts, England | 70734.126@compuserve.com
  47. -----------------------------------------
  48.